<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="referrer" content="no-referrer"/>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/static/lib/font-awesome/css/font-awesome.css">

    <script src="/static/lib/jquery-1.11.1.min.js" type="text/javascript"></script>

    <script src="/static/lib/jQuery-Knob/js/jquery.knob.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $(".knob").knob();
        });
    </script>

    <link rel="stylesheet" type="text/css" href="/static/stylesheets/theme.css">
    <link rel="stylesheet" type="text/css" href="/static/stylesheets/premium.css">

</head>

<body class=" theme-blue">

<!-- Demo page code -->

<script type="text/javascript">
    $(function () {
        var match = document.cookie.match(new RegExp('color=([^;]+)'));
        if (match) var color = match[1];
        if (color) {
            $('body').removeClass(function (index, css) {
                return (css.match(/\btheme-\S+/g) || []).join(' ')
            })
            $('body').addClass('theme-' + color);
        }
    })

    function photo_show(id) {
        var photos = window.document.getElementById("photos_show");
        $.ajax({
            url: '/eva_photo/?id=' + id,
            type: 'GET',
            dataType: 'json',
            success: function (photo_data) { //请求成功完成后要执行的方法
                console.log(photo_data);
                var str = '';
                if (!photo_data) {
                    photos.innerHTML = '';
                    return
                }
                for (photo in photo_data) {
                    str += "<div class='col-xs-6 col-md-6'>" +
                        "<a href=" + photo_data[photo] + " class='thumbnail'>" +
                        "<img src=" + photo_data[photo] + " class='img-responsive'>"
                        + "</a>"
                        + "</div>"
                }
                console.log(str)
                photos.innerHTML = str
            }
        })
    }

    function delcfm(url) {
        $('#url').val(url);//给会话中的隐藏属性URL赋值
    }

    function urlSubmit() {
        var url = $.trim($("#url").val());//获取会话中的隐藏属性URL
        console.log(url);
        window.location.href = url;
    }
</script>
<style type="text/css">
    #line-chart {
        height: 300px;
        width: 800px;
        margin: 0px auto;
        margin-top: 1em;
    }

    .navbar-default .navbar-brand,
    .navbar-default .navbar-brand:hover {
        color: #fff;
    }
</style>

<div class="navbar navbar-default" role="navigation" style="height: 80px;">
    <div class="navbar-header">
        <a class=""><span class="navbar-brand" style="font-size: 20px;font-weight:bold;"><img
                src="/static/images/schoolBadge.png"
                style="height: 55px;width: 55px" alt=""/> 干部信息录入系统</span></a>
    </div>
    <div class="navbar-collapse collapse" style="height: 1px;">
        <ul id="main-menu" class="nav navbar-nav navbar-right">
            <li class="dropdown hidden-xs">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <span class="glyphicon glyphicon-user padding-right-small"
                          style="position:relative;height: 49px;"></span>{{ user.user_name }}
                    <i class="fa fa-caret-down"></i>
                </a>
                <ul class="dropdown-menu">
                    <li>
                        <a tabindex="-1" href="/user_login/">注销</a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>

<div class="sidebar-nav">
    <ul>
        <li>
            <a href="#" class="nav-header" data-toggle="collapse"><i class="fa fa-fw fa-dashboard"></i> 信息管理</i>
            </a>
        </li>
        <li>
            <ul class="dashboard-menu nav nav-list collapse in">
                <li>
                    <a href="/user_index/"><span class="fa fa-caret-right"></span>个人信息</a>
                </li>
                <li>
                    <a href="/user_edit/"><span class="fa fa-caret-right"></span>修改信息</a>
                </li>
                <li>
                    <a href="/user_eva/"><span class="fa fa-caret-right"></span>评奖评优</a>
                </li>
            </ul>
        </li>
    </ul>
</div>
<div class="content">
    <div class="header">
        <h1 class="page-title">评奖评优信息</h1>
    </div>
    <div class="main-content">

        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#home" data-toggle="tab">未审核</a>
            </li>
            <li>
                <a href="#agree" data-toggle="tab">审核通过</a>
            </li>
            <li>
                <a href="#disagree" data-toggle="tab">审核未通过</a>
            </li>
            <a href="#addApp" role="button" data-toggle="modal" class="pull-right">
                <button class="btn btn-primary"><i class="fa fa-plus"></i> 提交申请</button>
            </a>
        </ul>

    </div>
    <div id="url"></div>
    <div class="row">
        <div class="main-content">
            <br>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane active in" id="home">
                    <table class="table">
                        <thead>
                        <tr></tr>
                        <tr>
                            <th>#</th>
                            <th>证书名称</th>
                            <th>证书获得日期</th>
                            <th style="width: 20em;"></th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for app in app_list0 %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td>{{ app.app_name }}</td>
                                <td>{{ app.app_data }}</td>
                                <td>
                                    <a href="#myModal" role="button" data-toggle="modal"
                                       onclick="photo_show({{ app.id }})"><i class="fa fa-search"></i>&nbsp;查看图片</a>
                                    &nbsp;&nbsp;&nbsp;
                                    <a href="#delModel" role="button" data-toggle="modal"
                                       onclick="delcfm('/eva_del/?id={{ app.id }}')"><i class="fa fa-trash-o"></i>&nbsp;删除记录</a>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>

                <div class="tab-pane fade" id="agree">
                    <table class="table">
                        <thead>
                        <tr></tr>
                        <tr>
                            <th>#</th>
                            <th>证书名称</th>
                            <th>证书获得日期</th>
                            <th style="width: 20em;"></th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for app in app_list1 %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td>{{ app.app_name }}</td>
                                <td>{{ app.app_data }}</td>
                                <td>
                                    <a href="#myModal" role="button" data-toggle="modal"
                                       onclick="photo_show({{ app.id }})"><i class="fa fa-search"></i>&nbsp;查看图片</a>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
                <div class="tab-pane fade" id="disagree">
                    <table class="table">
                        <thead>
                        <tr></tr>
                        <tr>
                            <th>#</th>
                            <th>证书名称</th>
                            <th>证书获得日期</th>
                            <th style="width: 20em;"></th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for app in app_list2 %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td>{{ app.app_name }}</td>
                                <td>{{ app.app_data }}</td>
                                <td>
                                    <a href="#myModal" role="button" data-toggle="modal"
                                       onclick="photo_show({{ app.id }})"><i class="fa fa-search"></i>&nbsp;查看图片</a>
                                    &nbsp;&nbsp;&nbsp;
                                    <a href="#delModel" role="button" data-toggle="modal"
                                       onclick="delcfm(/eva_del/?id={{ app.id }})"><i class="fa fa-trash-o"></i>&nbsp;删除记录</a>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" style="width: 60%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">证书图片</h3>
            </div>
            <div class="modal-body">
                <div class="row" id="photos_show">
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
            </div>
        </div>
    </div>
</div>
<div class="modal small fade" id="delModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">删除用户</h3>
            </div>
            <div class="modal-body">
                <p class="error-text"><i class="fa fa-warning modal-icon"></i>是否确定删除？</p>
                <p class="error-text">如果删除，将无法恢复！</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
                <button class="btn btn-danger" data-dismiss="modal" onclick="urlSubmit()">删除</button>
            </div>
        </div>
    </div>
</div>
<div class="modal small fade" id="addApp" tabindex="-1" role="dialog" aria-labelledby="addUserLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:550px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="addLabel">提交申请</h3>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-4">
                        <div id="myTabContent" class="tab-content">
                            <div class="tab-pane active in" id="home">
                                <form id="tab" method="POST" enctype="multipart/form-data" action="/eva_add/"
                                      style="width: 520px;">
                                    <div class="form-group">
                                        <label>证书名称</label>
                                        <input type="text" class="form-control" name="app_name">
                                    </div>
                                    <div class="form-group">
                                        <label>证书获得日期</label>
                                        <input type="text" class="form-control" name="app_data">
                                    </div>
                                    <div class="form-group">
                                        <label>证件照片（可多选）</label>
                                        <input type="file" class="form-control" name="app_photos" multiple/>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                            Cancel
                                        </button>
                                        <input type="submit" class="btn btn-danger" name="添加" value="添加"
                                               style="width: 75px;">
                                    </div>
                                </form>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function () {
        $('.demo-cancel-click').click(function () {
            return false;
        });
    });
</script>
{% if messages %}
    <script type="text/javascript">
        {% for msg in messages %}
            alert('{{ msg.message }}');
        {% endfor %}
    </script>
{% endif %}
</body>

</html>